package com.video.system.service.impl;

import java.util.List;
import com.video.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.video.system.mapper.VideoCategoryMapper;
import com.video.system.domain.VideoCategory;
import com.video.system.service.IVideoCategoryService;

/**
 * 课程分类Service业务层处理
 * 
 * @author lyh
 * @date 2021-07-31
 */
@Service
public class VideoCategoryServiceImpl implements IVideoCategoryService 
{
    @Autowired
    private VideoCategoryMapper videoCategoryMapper;

    @Override
    public List<VideoCategory> selectCodeAndNameList() {
        return videoCategoryMapper.selectCodeAndNameList();
    }

    /**
     * 查询课程分类
     * 
     * @param caId 课程分类ID
     * @return 课程分类
     */
    @Override
    public VideoCategory selectVideoCategoryById(Integer caId)
    {
        return videoCategoryMapper.selectVideoCategoryById(caId);
    }

    /**
     * 查询课程分类列表
     * 
     * @param videoCategory 课程分类
     * @return 课程分类
     */
    @Override
    public List<VideoCategory> selectVideoCategoryList(VideoCategory videoCategory)
    {
        return videoCategoryMapper.selectVideoCategoryList(videoCategory);
    }

    /**
     * 新增课程分类
     * 
     * @param videoCategory 课程分类
     * @return 结果
     */
    @Override
    public int insertVideoCategory(VideoCategory videoCategory)
    {
        videoCategory.setCreateTime(DateUtils.getNowDate());
        return videoCategoryMapper.insertVideoCategory(videoCategory);
    }

    /**
     * 修改课程分类
     * 
     * @param videoCategory 课程分类
     * @return 结果
     */
    @Override
    public int updateVideoCategory(VideoCategory videoCategory)
    {
        videoCategory.setUpdateTime(DateUtils.getNowDate());
        return videoCategoryMapper.updateVideoCategory(videoCategory);
    }

    /**
     * 批量删除课程分类
     * 
     * @param caIds 需要删除的课程分类ID
     * @return 结果
     */
    @Override
    public int deleteVideoCategoryByIds(Integer[] caIds)
    {
        return videoCategoryMapper.deleteVideoCategoryByIds(caIds);
    }

    /**
     * 删除课程分类信息
     * 
     * @param caId 课程分类ID
     * @return 结果
     */
    @Override
    public int deleteVideoCategoryById(Integer caId)
    {
        return videoCategoryMapper.deleteVideoCategoryById(caId);
    }
}
